
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">

    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <meta name="description" content="Curl命令自动生成代码神器">
    <meta name="author" content="anquanclub">
    
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-title" content="curlconverter">
    <meta name="format-detection" content="telephone=no">

    <meta name="mobile-web-app-capable" content="yes">

    <link rel="preload" href="/tree-sitter.wasm" type="application/wasm" as="fetch" crossorigin>
    <link rel="preload" href="/tree-sitter-bash.wasm" type="application/wasm" as="fetch" crossorigin>

    <link rel="icon" href="/favicon.ico" type="image/x-icon">
    <link rel="apple-touch-icon" href="/apple-touch-icon.png">
    <link rel="manifest" href="/site.webmanifest">

    <link href="/main.css" rel="stylesheet">

    <title>Curl代码转换 | 在线工具</title>
  </head>
  <body>

  <div class="container-md py-2">
    <div class="row">
      <div class="col-8 col-sm-10 col-md-11">
        <h3 class="text-muted d-none d-md-block">将 <a href="">curl</a> 代码在线转换为Python, JavaScript, PHP, R, Go, C#, Ruby, Rust, Elixir, Java, MATLAB, Dart, CFML, Ansible URI, Strest, JSON</h3>
        <h3 class="text-muted d-block d-md-none">将 <a href="">curl</a> 代码在线转换为Python, JavaScript更多</h3>
      </div>
    </div>
  </div>
  <!--<a class="github-fork-ribbon right-top" href="#" data-ribbon="Fork me on GitHub" title="Fork me on GitHub">Fork me on GitHub</a>-->

  <div class="container-xl pb-4">
    <div class="row pb-3">
      <div class="col-12 col-sm-5 order-1">
        <h2 class="mb-sm-0">curl命令</h2>
      </div>
      <div class="col-12 col-sm-6 col-xl-7 order-3 order-sm-2 pt-sm-3 text-end">
        <small class="examples align-top">
          示例:
          <a id="get-example" href="#">GET</a>
          -
          <a id="post-example" href="#">POST</a>
          -
          <a id="basic-auth-example" href="#">Basic Auth</a>
        </small>
      </div>
      <div class="col-12 order-2 order-sm-3 pb-sm-3">
        <textarea id="curl-code" class="form-control" placeholder="curl example.com" rows=6 spellcheck="false" autocorrect="off" autocapitalize="none" disabled></textarea>
      </div>
    </div>

    <div class="row pb-1 pb-lg-0" role="navigation">
      <div class="col-sm-auto d-none d-sm-block d-xl-none py-1">
        <h2>编程语言:</h2>
      </div>
      <div class="col col-sm-auto d-xl-none px-sm-0">
        <select class="form-select form-select-lg" id="language-select">
          <option value="ansible">Ansible</option>
          <option value="csharp">C#</option>
          <option value="cfml">ColdFusion ML</option>
          <option value="dart">Dart</option>
          <option value="elixir">Elixir</option>
          <option value="go">Go</option>
          <option value="java">Java</option>
          <option value="javascript">JavaScript</option>
          <option value="json">JSON</option>
          <option value="node-axios">Node.js (Axios)</option>
          <option value="node-fetch">Node.js (node-fetch)</option>
          <option value="node-request">Node.js (request)</option>
          <option value="matlab">MATLAB</option>
          <option value="php">PHP</option>
          <option value="python" selected>Python</option>
          <option value="r">R</option>
          <option value="ruby">Ruby</option>
          <option value="rust">Rust</option>
          <option value="strest">Strest</option>
        </select>
      </div>
      <ul class="nav nav-tabs d-none d-xl-flex px-3" id="language-navbar">
        <li class="nav-item">
          <a class="nav-link" href="/ansible/">Ansible</a>
        </li>
        <li class="nav-item">
          <a class="nav-link nav-link-outbound" href="https://everything.curl.dev/libcurl/libcurl">
            <!--! Font Awesome Pro 6.1.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. -->
            C <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M256 64C256 46.33 270.3 32 288 32H415.1C415.1 32 415.1 32 415.1 32C420.3 32 424.5 32.86 428.2 34.43C431.1 35.98 435.5 38.27 438.6 41.3C438.6 41.35 438.6 41.4 438.7 41.44C444.9 47.66 447.1 55.78 448 63.9C448 63.94 448 63.97 448 64V192C448 209.7 433.7 224 416 224C398.3 224 384 209.7 384 192V141.3L214.6 310.6C202.1 323.1 181.9 323.1 169.4 310.6C156.9 298.1 156.9 277.9 169.4 265.4L338.7 96H288C270.3 96 256 81.67 256 64V64zM0 128C0 92.65 28.65 64 64 64H160C177.7 64 192 78.33 192 96C192 113.7 177.7 128 160 128H64V416H352V320C352 302.3 366.3 288 384 288C401.7 288 416 302.3 416 320V416C416 451.3 387.3 480 352 480H64C28.65 480 0 451.3 0 416V128z"/></svg>
          </a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="/csharp/">C#</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="/cfml/" title="ColdFusion Markup Language">CFML</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="/dart/">Dart</a>
        </li>
        <li class="nav-item">
          <a class="nav-link active" href="/elixir/">Elixir</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="/go/">Go</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="/java/">Java</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="/javascript/">JavaScript</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="/json/">JSON</a>
        </li>
        <li class="nav-item dropdown">
          <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-expanded="false">Node.js</a>
          <ul class="dropdown-menu">
            <li><a class="dropdown-item" href="/node-axios/">Axios</a></li>
            <li><a class="dropdown-item" href="/node-fetch/">node-fetch</a></li>
            <li><a class="dropdown-item" href="/node-request/">request</a></li>
          </ul>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="/matlab/">MATLAB</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="/php/">PHP</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="/python/">Python</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="/r/">R</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="/ruby/">Ruby</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="/rust/">Rust</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="/strest/">Strest</a>
        </li>
      </ul>
    </div>

    <div class="row">
      <div class="col">
        <pre><code id="generated-code">response = <span class="hljs-title class_">HTTPoison</span>.get!(<span class="hljs-string">&quot;http://example.com&quot;</span>)
</code></pre>
      </div>
    </div>
    <div class="row">
      <div id="copy-to-clipboard" class="text-end"><a href="#">复制到剪贴板</a></div>
      <div style="display: none;" id="issue-promo">如果您遇到了问题，您可以
        <a href="https://www.anquanclub.cn/posts-edit/" target="_blank">发帖</a>咨询 <span style="display: none;" id="prefilled-issue">或者<a href="" target="_blank">使用我们给的模板内容先进行校验</a></span>
      </div>
      
    </div>
    <div class="row">
      <div id="warnings-container" class="col pt-3" style="display: none;">
        <pre><code id="warnings" style="display: block;"></code></pre>
      </div>
    </div>

  </div>
  <div class="container-md pb-4">
    <div class="row border-top py-4">
      <div class="col-lg-4" id="chrome">
        <h3>如何在Chrome浏览器获取curl命令</h3>
        <ol>
          <li>打开<a href="https://developer.chrome.com/docs/devtools/overview/">开发者工具</a>中的<a href="https://developer.chrome.com/docs/devtools/network/">网络</a>选项卡</li>
          <li>选择Fetch/XHR并重新点击页面中的按钮进行请求</li>
          <li>右键 复制&#8594; <span class="not-windows">以cURL格式复制</span><span class="windows d-none">"以cURL(<b>bash</b>)格式复制"</span></li>
          <li>将其粘贴到上方的<b>curl命令</b>输入框</li>
        </ol>
        <p>
          我们的工具同样也支持<a class="to-safari" href="#">Safari</a>和<a class="to-firefox" href="#">Firefox</a>浏览器
        </p>
        <p class="d-none d-lg-block pt-3">
          <b>温馨提示</b>: 获取的curl命令里的cookie部分可能会包含您的密码信息，因此复制发给他人的时候，记得将cookie部分脱敏
        </p>
      </div>
      <div class="col-lg-4 d-none" id="safari">
        <h3>如何在Safari浏览器获取curl命令</h3>
        <ol>
          <li>打开<a href="https://support.apple.com/en-us/guide/safari-developer/dev073038698/mac">开发者工具</a>中的<a href="https://support.apple.com/en-us/guide/safari-developer/dev1f3525e58/mac">网络</a>选项卡</li>
          <li>重新点击页面中的按钮进行请求</li>
          <li>右键点击"Copy as cURL"</li>
          <li>将其粘贴到上方的<b>curl命令</b>输入框</li>
        </ol>
        <p>
          我们的工具同样也支持<a class="to-chrome" href="#">Chrome</a>和<a class="to-firefox" href="#">Firefox</a>浏览器
        </p>
        <p class="d-none d-lg-block pt-3">
          <b>温馨提示</b>: 获取的curl命令里的cookie部分可能会包含您的密码信息，因此复制发给他人的时候，记得将cookie部分脱敏
        </p>
      </div>
      <div class="col-lg-4 d-none" id="firefox">
        <h3>如何在Firefox浏览器获取curl命令</h3>
        <ol>
          <li>打开<a href="https://developer.mozilla.org/en-US/docs/Tools">开发者工具</a>中的<a href="https://developer.mozilla.org/en-US/docs/Tools/Network_Monitor">网络</a>选项卡</li>
          <li>选择Fetch/XHR并重新点击页面中的按钮进行请求</li>
          <li>右键 复制&#8594;"Copy as cURL"</li>
          <li>将其粘贴到上方的<b>curl命令</b>输入框</li>
        </ol>
        <p>
          我们的工具同样也支持<a class="to-chrome" href="#">Chrome</a>和<a class="to-safari" href="#">Safari</a>浏览器
        </p>
        <p class="d-none d-xl-block pt-3">
          <b>温馨提示</b>: 获取的curl命令里的cookie部分可能会包含您的密码信息，因此复制发给他人的时候，记得将cookie部分脱敏
        </p>
      </div>
      <div class="col-lg-8">
          <img class="img-fluid mx-auto d-block" src="/images/chrome.png"  width="648" height="354" alt="screenshot of browser DevTools showing how to copy a network request as curl">
      </div>
    </div>

    <div class="row border-top pt-4">
      <div class="col-sm-12 col-md-4">
        <h3>隐私相关</h3>
        <p>
          我们<b>不会</b>转发或者记录您转换的curl命令
          这是一个静态的页面(由<a href="https://www.anquanclub.cn/">安全小天地</a>维护)，并且代码转换使用JavaScript<a href="https://github.com/curlconverter/curltorequests/blob/master/index.js">完全发生在您的浏览器</a>
        </p>
      </div>
      <div class="col-sm-6 col-md-4">
        <h3>友情链接</h3>
        <ul>
          <li><a href="https://www.anquanclub.cn/">安全小天地</a></li>
          <li><a href="https://www.anquanclub.cn/tools/moyu">在线摸鱼神器</a></li>
          <li><a href="https://www.anquanclub.cn/tools/yundong">在线运动步数</a></li>
          <li><a href="http://mail.anquanclub.cn:8000">安全小邮局</a></li>
          <li><a href="https://tools.anquanclub.cn/">安全小工具</a></li>
        </ul>
      </div>
    </div>
  </div>
  <script src="/main.js"></script>
  </body>
</html>
